<?php
$meta_ip_address = "172.18.1.50";
$fp = fopen("metaswitch/sdk/xml/soap/ShServiceTyped.wsdl", "r") or DIE ("Unable to read ShServiceTyped.wsdl");
#$xml = new SimpleXMLElement("metaswitch/sdk/xml/soap/ShServiceTyped.wsdl");

#echo $xml->wsdl[0];

$buf = "";
while($line = fgets($fp)){
	//echo $buf;
// <wsdlsoap:address location="http://IP_ADDRESS:8080/services/ShService"/>
	if (preg_match("/wsdlsoap:address/", $line)) {
		//fputs($fp, "newline");
		
		$line = "\t\t\t<wsdlsoap:address location=\"http://$meta_ip_address:8080/services/ShService\"/>\n";
		//echo "<wsdlsoap:address location=\"http://$meta_ip_address:8080/services/ShService\"/>\n";
	}
	$buf.= $line;
}
//Close the pointer to the readonly file
fclose($fp);

//  Write everything to the file
$fp = fopen("metaswitch/sdk/xml/soap/ShServiceTyped.wsdl", "w") or DIE ("Unable to read ShServiceTyped.wsdl");
fwrite($fp, $buf);
fclose($fp);
//echo $buf;

?>
